/* CodeMirror编辑器样式定制 */
.CodeMirror {
    height: 100% !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    border: none !important;
}

.CodeMirror-scroll {
    padding: 16px !important;
}

.CodeMirror-gutters {
    background: #f6f8fa !important;
    border-right: 1px solid #e1e4e8 !important;
}

.CodeMirror-linenumber {
    color: #586069 !important;
    padding: 0 8px !important;
}

.CodeMirror-cursor {
    border-left: 2px solid #0366d6 !important;
}

.CodeMirror-selected {
    background: #c8e1ff !important;
}

.CodeMirror-focused .CodeMirror-selected {
    background: #c8e1ff !important;
}

/* Markdown语法高亮 */
.cm-header {
    color: #0366d6 !important;
    font-weight: bold !important;
}

.cm-header-1 {
    font-size: 1.6em !important;
}

.cm-header-2 {
    font-size: 1.4em !important;
}

.cm-header-3 {
    font-size: 1.2em !important;
}

.cm-strong {
    color: #d73a49 !important;
    font-weight: bold !important;
}

.cm-em {
    color: #6f42c1 !important;
    font-style: italic !important;
}

.cm-link {
    color: #0366d6 !important;
    text-decoration: underline !important;
}

.cm-url {
    color: #032f62 !important;
}

.cm-quote {
    color: #6a737d !important;
    font-style: italic !important;
}

.cm-code {
    background: #f6f8fa !important;
    color: #d73a49 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
}

.cm-comment {
    color: #6a737d !important;
}

.cm-list {
    color: #0366d6 !important;
}

/* 代码块样式 */
.CodeMirror-line .cm-comment.cm-fenced {
    background: #f6f8fa !important;
    color: #586069 !important;
}

/* 搜索高亮 */
.CodeMirror-search-match {
    background: #ffdf5d !important;
    border: 1px solid #ffd33d !important;
}

/* 活动行高亮 */
.CodeMirror-activeline-background {
    background: #f6f8fa !important;
}

/* 折叠标记 */
.CodeMirror-foldmarker {
    color: #0366d6 !important;
    text-shadow: none !important;
    font-family: arial !important;
    line-height: 0.3 !important;
    cursor: pointer !important;
}

.CodeMirror-foldgutter {
    width: 16px !important;
}

.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
    cursor: pointer !important;
    color: #586069 !important;
}

.CodeMirror-foldgutter-open:after {
    content: "▼" !important;
}

.CodeMirror-foldgutter-folded:after {
    content: "▶" !important;
}

/* 预览内容样式 */
#preview-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #24292e;
}

#preview-content h1,
#preview-content h2,
#preview-content h3,
#preview-content h4,
#preview-content h5,
#preview-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: #24292e;
}

#preview-content h1 {
    font-size: 2em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

#preview-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eaecef;
    padding-bottom: 0.3em;
}

#preview-content h3 {
    font-size: 1.25em;
}

#preview-content h4 {
    font-size: 1em;
}

#preview-content h5 {
    font-size: 0.875em;
}

#preview-content h6 {
    font-size: 0.85em;
    color: #6a737d;
}

#preview-content p {
    margin-bottom: 16px;
}

#preview-content blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-left: 0.25em solid #dfe2e5;
    margin: 0 0 16px 0;
}

#preview-content ul,
#preview-content ol {
    padding-left: 2em;
    margin-bottom: 16px;
}

#preview-content li {
    margin-bottom: 0.25em;
}

#preview-content code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: rgba(27, 31, 35, 0.05);
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
}

#preview-content pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f6f8fa;
    border-radius: 6px;
    margin-bottom: 16px;
}

#preview-content pre code {
    display: inline;
    max-width: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    line-height: inherit;
    word-wrap: normal;
    background-color: transparent;
    border: 0;
}

#preview-content table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 16px;
    width: 100%;
}

#preview-content table th,
#preview-content table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5;
}

#preview-content table th {
    font-weight: 600;
    background-color: #f6f8fa;
}

#preview-content table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

#preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#preview-content a {
    color: #0366d6;
    text-decoration: none;
}

#preview-content a:hover {
    text-decoration: underline;
}

/* Mermaid图表样式 */
.mermaid {
    text-align: center;
    margin: 16px 0;
}

/* KaTeX数学公式样式 */
.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 16px 0;
    text-align: center;
}

/* 任务列表样式 */
#preview-content .task-list-item {
    list-style-type: none;
    margin-left: -1.5em;
}

#preview-content .task-list-item input {
    margin-right: 0.5em;
}

/* 高亮样式 */
#preview-content mark {
    background-color: #fff3cd;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

/* 删除线样式 */
#preview-content del {
    color: #6a737d;
    text-decoration: line-through;
}

/* 键盘按键样式 */
#preview-content kbd {
    display: inline-block;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 10px;
    color: #444d56;
    vertical-align: middle;
    background-color: #fafbfc;
    border: solid 1px #c6cbd1;
    border-bottom-color: #959da5;
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 #959da5;
}

/* 简单编辑器样式 */
.simple-editor {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 16px;
    background: #ffffff;
    color: #24292e;
    tab-size: 4;
}

.simple-editor:focus {
    box-shadow: inset 0 0 0 2px #0366d6;
}

/* 离线模式样式 */
.plantuml-fallback {
    margin: 1em 0;
}

.offline-notice {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 4px solid #6c757d;
    padding: 1rem;
    border-radius: 4px;
}

.offline-notice h4 {
    margin: 0 0 0.5rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.offline-notice p {
    margin: 0.5rem 0;
    color: #6c757d;
}

.offline-notice details {
    margin: 0.5rem 0;
}

.offline-notice summary {
    cursor: pointer;
    color: #007bff;
    font-weight: 500;
}

.offline-notice summary:hover {
    color: #0056b3;
}

.offline-notice pre {
    background: #f1f3f4;
    border: 1px solid #e1e5e9;
    border-radius: 3px;
    padding: 0.5rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-size: 0.9rem;
}

.offline-notice small {
    color: #868e96;
    font-style: italic;
}